﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlNhapHoaDonBanHang.ascx.cs" Inherits="UserControl_ControlNhapHoaDonBanHang" %>
<%@ Import Namespace="webapp4U" %>
 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
 <%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>


<%@ Register src="ControlReportViewer.ascx" tagname="ControlReportViewer" tagprefix="uc1" %>


<style type="text/css">

.AutoExtender
        {
            border: solid 1px #006699;
            line-height: 20px;
            padding: 10px;
            background-color: White;
            margin-left:10px;
            width: 300px;
        }
        .AutoExtenderList
        {
            border-bottom: dotted 1px #006699;
            cursor: pointer;
            color: Maroon;
        }
        .AutoExtenderHighlight
        {
            color: White;
            background-color: #006699;
            cursor: pointer;
        }
       
       #divwidthMaHang
       {
       	width: auto !important;  
       }
        #divwidthMaHang div
       {
       	width: auto !important;  
       } 
       
       #divwidthMaKhachHang
       {
       	width: auto !important;  
       }
        #divwidthMaKhachHang div
       {
       	width: auto !important;  
       } 
</style>


<script type="text/javascript">
    function pageLoad() {

        var startdate;

        //Lấy ngày workingday
        $.ajax({
            type: "POST",
            url: '<%=ResolveUrl("~/Webservice/WebServiceDRM.asmx/GetWorkingDay")%>',
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#<%= txtDate.ClientID %>").datePicker(
		        {
		            clickInput: true,
		            startDate: data.d
		        });
            }
        });




        $("#<%= txtSoTienGiam.ClientID %>").numeric({ allow: "." });

        $("#<%= imgBtnAddKH.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });

    $("#<%= btnSaveKH.ClientID %>").click(function () {
        $.blockUI({ css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
        });
});
      
        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnSave.ClientID %>").click(function() {
            if ($("#<%= txtTongTien.ClientID %>").val().length > 0) {
                $.blockUI({ css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                    opacity: .5,
                    color: '#fff'
                }
                });
            }
    });
    $("#<%= btSave.ClientID %>").click(function () {
    if ($("#<%= txtSoTienGiam.ClientID %>").val().length > 0) {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        }
    });
        

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <dxpc:ASPxPopupControl AllowDragging="true" HeaderText="Tạo mới khách hàng" PopupHorizontalAlign="Center" PopupVerticalAlign="Middle" ID="ASPxPopupAddKH" runat="server" Height="400px" 
            Width="600px" AllowResize="true" ShowPageScrollbarWhenModal="true">
            <ContentCollection>
                  <dxpc:PopupControlContentControl ID="PopupControlContentControl2" runat="server" SupportsDisabledAttribute="True">

                         
                                      
                                      <table border="0" width="100%">
                               
                                <tr>
                                    <td align="right"><p class="direct_label">Họ tên<span>*</span></p></td>
                                    <td align="left">
                                        <asp:TextBox ID="txtHoTenKhTaoMoi" CssClass="input_full" runat="server"></asp:TextBox>
                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right"><p class="direct_label">Xưng hô</p></td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlXungHo" runat="server"></asp:DropDownList>
                                    </td>
                                </tr>
                                 <tr>
                                    <td align="right"><p class="direct_label">Địa chỉ liên lạc<span>*</span></p></td>
                                    <td align="left"><asp:TextBox ID="txtDiaChiLienLac" CssClass="input_full" runat="server"></asp:TextBox>
                                       
                                    </td>
                                </tr>      
                                <tr>
                                    <td align="right"><p class="direct_label">Số điện thoại<span>*</span></p></td>
                                    <td align="left">
                                        <asp:TextBox ID="txtMobileTKH" CssClass="input_full" runat="server"></asp:TextBox>
                                        <asp:Button ID="btnSaveKH" runat="server" Text="Lưu" onclick="btnSaveKH_Click"/>
                                    </td>
                                </tr>    
                                </table>    
                                      
                                       
                                  
                          
                  </dxpc:PopupControlContentControl>
            </ContentCollection>
    </dxpc:ASPxPopupControl>

     <dxpc:ASPxPopupControl AllowDragging="true" PopupHorizontalAlign="Center" PopupVerticalAlign="Middle" ID="ASPxPopupControl1" runat="server" Height="400px" 
            Width="600px" AllowResize="true" ShowPageScrollbarWhenModal="true">
            <ContentCollection>
                  <dxpc:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
    <br />
    <asp:Label ID="lblNhan" runat="server" Text="Số tiền hóa đơn" Font-Bold="True" Font-Size="Larger"></asp:Label>
    <asp:Label ID="lblSoTien" runat="server" Text="Số tiền hóa đơn" Font-Bold="True" Font-Size="Larger"></asp:Label>
    <br />
    <asp:Label ID="lblTienGiam" runat="server" Text="Số tiền giảm :" Font-Bold="True" Font-Size="Larger"></asp:Label>
    <asp:TextBox ID="txtSoTienGiam" ontextchanged="txtSoTienGiam_TextChanged" AutoPostBack="True" Text="0" runat="server" Font-Bold="True" Font-Size="Larger"></asp:TextBox>  
    <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtenderSLEdit" 
        runat="server" Enabled="True" FilterType="Numbers" 
        TargetControlID="txtSoTienGiam">
     </cc1:FilteredTextBoxExtender>  
    <br />
    <asp:Label ID="LabelTienTra" runat="server" Text="Số tiền phải trả :" Font-Bold="True" Font-Size="Larger"></asp:Label>
    <asp:Label ID="lblSoTienPhaiTra" runat="server"  Text="" Font-Bold="True" Font-Size="Larger"></asp:Label>
    <asp:Button ID="btSave" runat="server" Text="In Hóa Đơn" OnClick="btSave_Click" />
    <br />
    Hàng khuyến mãi :<br />
     <asp:Label ID="Label1" runat="server" Text="Mã hàng"></asp:Label>
      <asp:TextBox ID="txtMaHangKM" CssClass="input_code" runat="server" AutoPostBack="True" ontextchanged="txtMaHangKM_TextChanged"></asp:TextBox>

                                     <div id="divKM" style="overflow:scroll;height:150px;display:none"></div>
                                            <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" 
                                                runat="server"
                                                ServiceMethod="GetMatHangInfo" ServicePath="~/Webservice/WebServiceDRM.asmx" 
                                                TargetControlID="txtMaHangKM"
                                                MinimumPrefixLength="1" 
                                                CompletionInterval="10"
                                                CompletionSetCount="12"                             
                                                CompletionListCssClass="AutoExtender"
                                                CompletionListItemCssClass="AutoExtenderList"
                                                CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                                CompletionListElementID="divKM" DelimiterCharacters="" 
                                        Enabled="True"></cc1:AutoCompleteExtender>
     <asp:TextBox ID="txtTenHangKM" ReadOnly="True" CssClass="input_full" runat="server"></asp:TextBox>
      <asp:Button ID="btAddKM" runat="server" Text="Thêm KM" OnClick="btAddKM_Click" />
     <br />
       <asp:GridView ID="grvKM" AutoGenerateColumns="False"
                                    DataKeyNames="Mã hàng"                           
                                    runat="server" onrowcancelingedit="grvKM_RowCancelingEdit" 
                                    onrowdeleting="grvKM_RowDeleting" Width="100%"
                                    onrowediting="grvKM_RowEditing" 
                                    onrowupdating="grvKM_RowUpdating" CellPadding="4" 
                                    ForeColor="#333333" GridLines="None" EnableModelValidation="True" >
                                    <AlternatingRowStyle BackColor="White" />
                                    <Columns>
                                           
                            
                                    <asp:TemplateField HeaderText="Stt"><HeaderTemplate>
                                                                    STT
                                                                
                                         
</HeaderTemplate>
<ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
                                    <asp:TemplateField HeaderText="Mã hàng"><HeaderTemplate>
                                                                    Mã hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblMaHang" runat="server" Text='<%# Eval("Mã hàng")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="100px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
</asp:TemplateField>
                                    <asp:TemplateField HeaderText="Tên hàng"><HeaderTemplate>
                                                                    Tên hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("Tên hàng")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
 <asp:TemplateField HeaderText="Số lượng">
<EditItemTemplate>
             <asp:TextBox ID="txtSL" CssClass="input_code" Text='<%# Eval("Số lượng")%>' runat="server"></asp:TextBox>
             <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" 
                                                        runat="server" Enabled="True" FilterType="Numbers" 
                                                        TargetControlID="txtSL">
                                                 </cc1:FilteredTextBoxExtender>
</EditItemTemplate>
<HeaderTemplate>
                                                                    Số lượng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
          
             <asp:Label ID="lblSL" runat="server" Text='<%# Eval("Số lượng")%>'></asp:Label>                                                   
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="100px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
</asp:TemplateField>
 <asp:CommandField CausesValidation="False" HeaderText="Sửa" 
                                                                 ShowEditButton="True" ButtonType="Image"
                                                                EditImageUrl="~/images/repair_bt.png" EditText="Sửa" 
                                                                CancelImageUrl="~/images/exit_bt.png" CancelText="Thoát" UpdateText="Cập nhập" 
                                                                UpdateImageUrl="~/images/update_bt.png" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
                                    <asp:CommandField  ButtonType="Image" DeleteText="Xóa" 
                                                                DeleteImageUrl="~/images/delete.png" CausesValidation="False" HeaderText="Xóa" 
                                                                 ShowDeleteButton="True" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
</Columns>
                                    <FooterStyle  BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#066839" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                                </asp:GridView>
                </dxpc:PopupControlContentControl>
            </ContentCollection>
     </dxpc:ASPxPopupControl>

     <div class="direct_container_right_titletop">
                     Nhập hóa đơn bán hàng
                     </div>
                       <hr />
                <!-- Button chuc nang-->
                <div class="direct_container_main">
                    <asp:ImageButton ID="imgBtnAdd" ToolTip="Tạo mới đơn hàng" CausesValidation="false" 
                        ImageUrl="~/Images/add.png" Width="32px" Height="32px" runat="server" 
                        onclick="imgBtnAdd_Click" /></a>
                    <asp:ImageButton ID="imgBtnSave" ToolTip="Lưu đơn hàng" ImageUrl="~/Images/save.png" Width="32px" 
                        Height="32px" runat="server" onclick="imgBtnSave_Click" />
                    <asp:ImageButton ID="imgBtnAddKH" ToolTip="Thêm mới khách hàng" ImageUrl="~/Images/Buddy-Green.png" Width="32px" 
                        Height="32px" runat="server" onclick="imgBtnAddKH_Click" />
                   <%-- <asp:ImageButton ID="imgBtnFind" CausesValidation="false" 
                        ImageUrl="~/Images/find.png" Width="32px" Height="32px" runat="server" 
                        onclick="imgBtnFind_Click" />--%>
                        

                  
                </div>
                <!-- End Button chuc nang-->
              
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" 
            BackColor="#CCFFFF" Font-Names="Arial"  
            Width="100%">
             <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập hóa đơn" TabIndex="0">
                <ContentTemplate>
                   
                 
               
                <!-- Content main-->
                <div class="direct_container_main">
                    <div class="direct_container_form_right">
                        <table border="0" width="100%">
                         <tr>
                            <td align="right"><p class="direct_label">Ngày</p></td>
                            <td align="left" colspan="7">
                                <asp:TextBox ID="txtDate" CssClass="input_code" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                         <tr>
                            <td align="right"><p class="direct_label">Mã khách hàng</p></td>
                            <td align="left">
                                <asp:TextBox ID="txtMaKhachHang" CssClass="input_code" runat="server" AutoPostBack="True" 
                                    ontextchanged="txtMaKhachHang_TextChanged"></asp:TextBox>
                                <div id="divwidthMaKhachHang" style="overflow:scroll;height:150px;display:none"></div>
                                            <cc1:AutoCompleteExtender ID="AutoCompleteExtenderMaKH" 
                                                runat="server"
                                                ServiceMethod="GetFilterCustomerInfo" ServicePath="~/Webservice/WebServiceDRM.asmx" 
                                                TargetControlID="txtMaKhachHang"
                                                MinimumPrefixLength="1" 
                                                CompletionInterval="10"
                                                CompletionSetCount="12"                             
                                                CompletionListCssClass="AutoExtender"
                                                CompletionListItemCssClass="AutoExtenderList"
                                                CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                                CompletionListElementID="divwidthMaKhachHang" DelimiterCharacters="" 
                                        Enabled="True"></cc1:AutoCompleteExtender>

                                
                            </td>
                            <td colspan="6">
                                <asp:TextBox ID="txtTenKhachHang" CssClass="input_full" runat="server" 
                                    ReadOnly="True"></asp:TextBox>
                            </td>
                        </tr>
                                                 
                       
                         <tr>
                            <td align="right"><p class="direct_label">Tổng tiền</p></td>
                            <td align="left">
                                <asp:Label ID="txtTongTien" runat="server" Text=""></asp:Label>
                                <%--<asp:TextBox ID="txtTongTien" ReadOnly="True"   CssClass="input_code" runat="server"></asp:TextBox>--%>
                               
                            </td>
                        </tr>                              
                    </table>
                    <table>
                       
                        <tr>
                            <td >
                                                     

                                <asp:GridView ID="grvListOrderDetail" AutoGenerateColumns="False"
                                    DataKeyNames="Mã hàng"  onrowdatabound="grvListOrderDetail_RowDataBound1"                           
                                    runat="server" onrowcancelingedit="grvListOrderDetail_RowCancelingEdit" 
                                    onrowdeleting="grvListOrderDetail_RowDeleting" Width="100%"
                                    onrowediting="grvListOrderDetail_RowEditing" ShowFooter="true"
                                    onrowupdating="grvListOrderDetail_RowUpdating" CellPadding="4" 
                                    ForeColor="#333333" GridLines="None" EnableModelValidation="True" >
                                    <AlternatingRowStyle BackColor="White" />
                                    <Columns>                                           
                            
                                        <asp:TemplateField HeaderText="Stt">
                                            <HeaderTemplate>STT</HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Container.DataItemIndex + 1 %>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                        </asp:TemplateField>
                                    
                                        <asp:TemplateField HeaderText="Mã hàng">
                                        <HeaderTemplate>Mã hàng</HeaderTemplate>
                                            <ItemTemplate>        
                                                <asp:Label ID="lblMaHang" runat="server" Text='<%# Eval("Mã hàng")%>'></asp:Label>                                               
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                            
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtMaHang" CssClass="input_code" runat="server" AutoPostBack="True" 
                                                    ontextchanged="txtMaHang_TextChanged"></asp:TextBox>

                                                 <div id="divwidthMaHang" style="overflow:scroll;height:150px;display:none"></div>
                                                    <cc1:AutoCompleteExtender ID="txtMaHang_AutoCompleteExtender" 
                                                        runat="server"
                                                        ServiceMethod="GetMatHangInfo" ServicePath="~/Webservice/WebServiceDRM.asmx" 
                                                        TargetControlID="txtMaHang"
                                                        MinimumPrefixLength="1" 
                                                        CompletionInterval="10"
                                                        CompletionSetCount="12"                             
                                                        CompletionListCssClass="AutoExtender"
                                                        CompletionListItemCssClass="AutoExtenderList"
                                                        CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                                        CompletionListElementID="divwidthMaHang" DelimiterCharacters="" 
                                                        Enabled="True">
                                                    </cc1:AutoCompleteExtender>

                                            </FooterTemplate>
                                        </asp:TemplateField>
                                        
                                        <asp:TemplateField HeaderText="Tên hàng">
                                            <HeaderTemplate>Tên hàng</HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("Tên hàng")%>'></asp:Label>                                             
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtTenHang" ReadOnly="True" CssClass="input_full" runat="server"></asp:TextBox> 
                                            </FooterTemplate>
                                            
                                        </asp:TemplateField>
                                        
                                        <asp:TemplateField HeaderText="Đơn giá">
                                            <HeaderTemplate>Đơn giá</HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblDG" runat="server" Text='<%# Eval("Đơn giá","{0:###,###}")%>'></asp:Label>                                                   
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                            <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtPrice" ReadOnly="True" CssClass="input_code" runat="server" Width="100px"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                        
                                    <asp:TemplateField HeaderText="Số lượng">
                                        <EditItemTemplate>
                                             <asp:TextBox ID="txtSL" CssClass="input_code" Text='<%# Eval("Số lượng")%>' runat="server"></asp:TextBox>
                                              <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" 
                                                    runat="server" Enabled="True" FilterType="Numbers" 
                                                    TargetControlID="txtSL">
                                             </cc1:FilteredTextBoxExtender>
                                        </EditItemTemplate>
                                        <HeaderTemplate>Số lượng</HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblSL" runat="server" Text='<%# Eval("Số lượng")%>'></asp:Label>                                                   
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                    
                                        <FooterTemplate>
                                            <asp:TextBox ID="txtSoLuong" Text="1" CssClass="input_code" runat="server" ontextchanged="txtSoLuong_TextChanged" Width="50px" TabIndex="5" AutoPostBack="true"></asp:TextBox>
                                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtenderSLEdit" 
                                                runat="server" Enabled="True" FilterType="Numbers" 
                                                TargetControlID="txtSoLuong"> 
                                            </cc1:FilteredTextBoxExtender>   
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="Chiết khấu">
                                        <EditItemTemplate>
                                             <asp:TextBox ID="txtCK" CssClass="input_code" Text='<%# Eval("Chiết khấu")%>' runat="server"></asp:TextBox>
                                              <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" 
                                                    runat="server" Enabled="True" FilterType="Numbers" 
                                                    TargetControlID="txtCK">
                                             </cc1:FilteredTextBoxExtender>
                                        </EditItemTemplate>
                                        <HeaderTemplate>Chiết khấu</HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblCK" runat="server" Text='<%# Eval("Chiết khấu")%>'></asp:Label>                                                   
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                        <FooterTemplate>
                                            <asp:Button ID="btAdd" runat="server" CssClass="direct_bt_search" Text="Thêm" TabIndex="5" CausesValidation="false" CommandName="AddRow"
                                            OnClick="btAdd_Click"  />
                                        </FooterTemplate>
                                        
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="Thành tiền">
                                        <HeaderTemplate>Thành tiền</HeaderTemplate>
                                        <ItemTemplate>                                               
                                            <asp:Label ID="lblThanhTien" runat="server" Text='<%# Eval("Thành tiền","{0:###,###}")%>'></asp:Label>                                               
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    
                                    <asp:CommandField CausesValidation="False" HeaderText="Sửa" 
                                         ShowEditButton="True" ButtonType="Image"
                                        EditImageUrl="~/images/repair_bt.png" EditText="Sửa" 
                                        CancelImageUrl="~/images/exit_bt.png" CancelText="Thoát" UpdateText="Cập nhập" 
                                        UpdateImageUrl="~/images/update_bt.png" >
                                        <ControlStyle Height="25px" Width="25px" />
                                        <ItemStyle Height="25px" Width="25px" />
                                    </asp:CommandField>
                                                                            
                                    <asp:CommandField  ButtonType="Image" DeleteText="Xóa" 
                                        DeleteImageUrl="~/images/delete.png" CausesValidation="False" HeaderText="Xóa" 
                                        ShowDeleteButton="True" >
                                        <ControlStyle Height="25px" Width="25px" />
                                        <ItemStyle Height="25px" Width="25px" />
                                    </asp:CommandField>
                                </Columns>
                                <FooterStyle  BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#066839" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            </asp:GridView>
                            </td>
                        </tr>
                        
                    </table>
                    <div style="height:150px"></div>
                    </div>
                </div>
               </ContentTemplate>
            </cc1:TabPanel>
          
             <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="In hóa đơn" TabIndex="2">
                <ContentTemplate>
                   
                     <uc1:ControlReportViewer ID="ControlReportViewer1" runat="server" />         
                </ContentTemplate>
            </cc1:TabPanel>               
        </cc1:TabContainer>



    <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
                <dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True">
                </dxpc:PopupControlContentControl>
        </ContentCollection>
    </dxpc:ASPxPopupControl>
    
    <dxpc:ASPxPopupControl ID="MessageBoxVuotTon" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server"
        Width="401px">
        <ContentCollection>
                <dxpc:PopupControlContentControl ID="PopupControlContentControl3" runat="server" SupportsDisabledAttribute="True">
                    <table>
                        <tr>
                            <td>
                                Những mặt hàng vượt tồn kho
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:GridView ID="grvCheckVuotTon" runat="server">
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </dxpc:PopupControlContentControl>
        </ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>



    
     